package com.cet.reactor;

import reactor.core.publisher.Flux;

/**
 * handle 可以视为流处理中map和 filter的组合
 */
public class SequenceHandleDemo {

    public static void main(String[] args) {
        Flux.just(1,2,3,4,5,6,7,8,9)
                .handle((value, sink) -> {
                    System.out.println("value: " + value);
                    if (value % 2 == 0) {
                        sink.next(value);
                    }
                })
                .log()
                .subscribe();
    }
}
